# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
maintainer="team/kde <bribbers@disroot.org>"
pkgname=libkgapi
pkgver=24.08.2
pkgrel=0
pkgdesc="LibKGAPI is a KDE-based library for accessing various Google services via their public API"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64, armv7 and loongarch64 blocked by qt6-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64 !armv7 !loongarch64"
url="https://community.kde.org/KDE_PIM"
license="LGPL-2.1-only OR LGPL-3.0-only"
depends_dev="
	cyrus-sasl-dev
	kcalendarcore-dev
	kcontacts-dev
	kio-dev
	kwallet-dev
	kwindowsystem-dev
	qt6-qtbase-dev
	qt6-qtwebengine-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/pim/libkgapi.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/libkgapi-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	# calendar-event-*: UTC+02 != UTC+02:00
	xvfb-run ctest --test-dir build --output-on-failure -E "calendar-(event*job|calendardeletejobtest|eventdeletejobtest)"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
3bca4366ef25bf0f1e33bfd2f31dde10e70bbb68db9d7bfd2b6f727b4dd9d22c36c2dfdf0b1b88dfb5861d4cc50fff7da7bf76266289cf21ff54fc4c6af6b1b2  libkgapi-24.08.2.tar.xz
"
